///@file Sample.h
///@brief Declaration of the class representing a sample of a signal
///@author Arnaud Duval
///@version 0.0
///@date 2009/02/09


#ifndef SAMPLE_H
#define SAMPLE_H

#include <assert.h>
#include <iostream>
#include <cstring>


///@class Sample
///@brief Class defining a sample of a signal
/// A sample is an array of value given a sampling frequency
class Sample
{
	private:
		///@brief Array of values
		double *a;
		///@brief Number of samples
		unsigned int Nech;
		///@brief Sampling frequency
		double fech;
	public:
		///@brief Default constructor
		Sample();
		///@brief Constructor giving the number of samples
		Sample(int);
		///@brief Constructor giving the number of samples and the sampling frequency
		Sample(int, double);
		///@brief Destructor
		~Sample();
		///@brief Overload of [] operator
		double& operator[](unsigned int) const;	
		///@brief Clear all datas of the sample
		void Clear();
		///@brief Add a sinus to the current sample
		void AddSinus(double, double, double);
		///@brief Add a cosinus to the current sample
		void AddCosinus(double, double, double);
		///@brief Compute Fast Fourier Transform of the signal
		double* FFT();
		///@brief Swap two values
		void swap(double&, double&);
		///@brief Read sample from file
		void Read(std::string);
		///@brief Write sample to a file
		void Write(std::string);
		///@brief Write FFT of signal
		void WriteFFT(std::string);

		///@brief Overload of << operator
		friend std::ostream &operator << (std::ostream &, Sample&);

};

#endif